<script setup>
import { ref } from "vue";
const emit = defineEmits(['search']);
const keywords = ref('');
const keyDown = (e) => {
  //如果是回车则执行登录方法 喜欢的可以多研究下其他的按键keyCode
  if (e.keyCode == 13) {
    emit('search',keywords.value)
  }
}
const reset = () => {
    emit('search',keywords.value)
}



</script>

<template>
  <div class="filter_header_box">
    <div class="filter_left">
      <div class="filter_input_area">
        <div class="filter_input_icon">
            <img src="@/assets/sousuo_2X.png" alt="" />
        </div>
        <el-input v-model="keywords"  class="filter_input"  placeholder="请输入关键字搜索" @clear="reset"  @keyup.enter="(e) => {keyDown(e)}" clearable/>
      </div>
    </div>
    <div class="filter_right">
      <img src="@/assets/xiaoxizhongxin.svg" />
    </div>
  </div>
</template>
<style lang="less">
    .filter_input_area{
        .el-input__wrapper{
            border: none;
            box-shadow: none;
            background: transparent;
        }
        .el-input__wrapper.is-focus{
    box-shadow:  none;
  }
    }
</style>
<style lang="less" scoped>
.filter_header_box {
  padding: 10px 40px;
  display: flex;
  width: 100%;
  height: 80px;
  background: #ffffff;
  justify-content: space-between;
}
.filter_left {
  display: flex;
  flex-direction: row-reverse;
  width: 100%;
  padding-right: 40px;
  align-items: center;
}
.filter_input_area {
  width: 362px;
  height: 40px;
  background: #f5f7f7;
  border-radius: 21px;
  display: flex;
  align-items: center;
  padding: 0 30px;
  
  .filter_input_icon{
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    img{
        width: 22px;
        height: 22px;
    }
  }
  .filter_input {
    width: 100%;
    height: 17px;
    background: transparent;
    font-family: FZLTHK--GBK1, FZLTHK--GBK1;
    font-weight: normal;
    font-size: 14px;
    color: #333;
    line-height: 17px;
    letter-spacing: 1px;
    text-align: left;
    font-style: normal;
    appearance: none;
    outline: none;
    border: none;
  }
}

.filter_right {
  border-left: 1px solid rgba(151, 151, 151, 0.29);
  padding-left: 40px;
  display: flex;
  height: 60px;
  align-items: center;
}
</style>
